Building and Hosting Your Risotto Documentation Site
Building Your Site
Running the Build Command
To generate your static documentation site, use the following command in your project directory:
python3 risotto.py
Customizing the Build Process
You can customize the build process with the following parameters:
--docs: Specify the directory containing your Markdown files.
python3 risotto.py --docs my-docs
--config: Specify the configuration file to use.
python3 risotto.py --config custom.config.risotto
--output: Specify the output directory for the generated site.
python3 risotto.py --output build
What Happens During the Build
- All Markdown files in the specified docs directory are converted to HTML.
- The output directory is created if it doesn’t exist.
- Existing HTML files in the output directory are overwritten.
Previewing Your Site Locally
Using Python's Built-in Server
- Navigate to your output directory:
cd site
- Start a local server:
python3 -m http.server 8000
- Open your browser and go to:
Using Other Local Servers
You can also use tools like serve, live-server, or any other static file server to preview your site.
Hosting Your Site
Static Hosting Platforms
Risotto generates static HTML files, so you can host your site on any platform that supports static websites. Here are some popular options:
Netlify
- Drag and drop the output folder (e.g., site/) to Netlify’s dashboard.
- Your site will be deployed immediately and provided with a unique URL.
Vercel
- Install the Vercel CLI:
- Deploy your site:
- Follow the prompts to complete the deployment.
GitHub Pages
- Push the contents of your output folder to a GitHub repository.
- Go to the repository settings and enable GitHub Pages.
- Select the branch and folder containing your site files.
GitLab Pages
- Push the contents of your output folder to a GitLab repository.
- Create a
.gitlab-ci.ymlfile to configure the deployment. - GitLab will automatically build and deploy your site.
Surge
- Install Surge:
- Deploy your site:
- Follow the prompts to complete the deployment.
Using Custom Domains
Most static hosting platforms support custom domains. Here’s how to set it up on some popular platforms:
Selfhosted/Server
- Check your ip adress and make sure the correct port is exposed.
- Point a A record to that ip adress.
- Restart static website.
Netlify
- Go to your site’s settings in the Netlify dashboard.
- Navigate to the "Domain settings" section.
- Add your custom domain and follow the instructions to configure DNS settings.
Vercel
- Go to your project settings in the Vercel dashboard.
- Navigate to the "Domains" section.
- Add your custom domain and follow the instructions to configure DNS settings.
GitHub Pages
- Go to your repository settings on GitHub.
- Navigate to the "Pages" section.
- Enter your custom domain in the provided field.
- Configure your DNS settings as instructed.
Tips for Successful Hosting
- Ensure your output directory is included in your version control or deployment process.
- Regularly update your site by re-running the build command and redeploying.
- Use environment variables or configuration files to manage settings for different deployment environments.
- Monitor your site’s performance and optimize as needed.